#include <stdio.h>


int quicksort(int *arr,int low,int high);
int main(int argc, const char *argv[])
{
	int arr[10]={8,22,88,11,77,66,55,99,33,44};
	quicksort(arr,0,9);

	for(int i=0;i<10;i++)
	{
		printf("%d ",arr[i]);
	}

	return 0;
}

int quicksort(int *arr,int low,int high)
{
	if(low<high)
	{
		int flag=arr[low];
		int a=low;
		int b=high;
		while(high!=low)
		{
			while(low!=high&&flag<=arr[high])
			{
				high--;
			}
			if(low<high)
			{
				arr[low]=arr[high];
				low++;
			}
			while(low!=high&&flag>=arr[low])
			{
				low++;
			}
			if(low<high)
			{
				arr[high]=arr[low];
				high--;
			}
		}
		arr[high]=flag;
		quicksort(arr,a,low-1);
		quicksort(arr,low+1,b);
	}
	return 0;

}
